<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <style type="text/css">
    .form{
      width: 250px;
      height: 200px;
      margin: 0 auto;
      padding: 50px;
      text-align: center;
    }
    .w-150{
      width: 200px;
      margin-bottom: 10px;
    }

    .h-30{
      height: 30px;
    }

    .button {
      background-color: #4CAF50; /* Green */
      border: none;
      color: white;
      padding: 10px;
      width: 230px;
      text-align: center;
      text-decoration: none;
      display: inline-block;
      font-size: 16px;
      margin-bottom: 10px;
    }

  </style>
  <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
  </script>
</head>
<body>

<div class="form">
  <button class="button" id="login">下单</button>
</div>


</body>
<script>
  $(document).ready(function(){
    $("#login").click(function(){
      $.ajax(
          {
            url:"/api/order",
            type: "POST",
            success:function(result){
              alert("下单成功，请支付")
              window.location.href = "pay.html?order_number="+result;
            },
            error:function(err){
            }
          });
    });
  });
</script>
</html>
